import sys

if __name__ == "__main__":
    flag = sys.argv[1]
    n = int(sys.argv[2])
    lst = [i for i in "abcdefghijklmnopqrstuvwxyz"]
    res = []
    p = sys.argv[3]
    for i in p:
        j = i.lower()
        if j >= 'a' and j <= 'z':
            if flag == "e":
                res.append(lst[(lst.index(j) + n) % 26])
            elif flag == 'd':
                res.append(lst[(lst.index(j) - n) % 26])
        else:
            res.append(i)
    res = ''.join(res)
    print res
